package com.example.administrator.daydayappmarket.software.utils;

import android.app.Dialog;
import android.content.Context;
import android.support.v7.app.AlertDialog;
import android.view.Display;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageView;

import com.example.administrator.daydayappmarket.R;

/**
 * Created by lenovo on 2016/12/29.
 */

public class ShowDialogShare {


    public static void ShowDialog(Context context){
        final AlertDialog dialog=new AlertDialog.Builder(context).create();
        View view= LayoutInflater.from(context).inflate(R.layout.item_software_choice_dialog,null);
        dialog.setView(view);

        Window window = dialog.getWindow();
        window.setWindowAnimations(R.style.draw_dialog);
        window.setGravity(Gravity.BOTTOM);

//        WindowManager windowManager = window.getWindowManager();
//        Display defaultDisplay = windowManager.getDefaultDisplay();
//        WindowManager.LayoutParams attributes = window.getAttributes();
//        attributes.width=defaultDisplay.getWidth();
//        window.setAttributes(attributes);

        ImageView imageView= (ImageView) view.findViewById(R.id.item_software_choice_dialog_imageView);
        imageView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dialog.dismiss();
            }
        });


        dialog.show();
    }

}
